package com.sxzjrj.utils

import java.text.SimpleDateFormat

/**
  * Created by ljj in 2019/3/20
  *
  */
object CmccUtils {

  private lazy val dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS")

  def getCostTime(startTime: String, endTime: String): Long = {

    if (startTime.length >= 17 && endTime.length >= 17) {
      try {
        dateFormat.parse(endTime.substring(0, 17)).getTime - dateFormat.parse(startTime.substring(0, 17)).getTime
      } catch {
        case e: Exception => 0L
      }
    } else {
      0L
    }


  }


}
